﻿using DBProjectMVVM.Model;

namespace DBProjectMVVM.ViewModel
{
  /// <summary>
  /// This class is a view model of a contact.
  /// </summary>
  public class ContactViewModel : ObservableObject
  {
    #region Members

    private Contact vm_contact;

    #endregion


    #region Properties

    public string FirstName
    {
      get
      {
        return vm_contact.FirstName;
      }
      set
      {
        if (vm_contact.FirstName != value)
        {
          vm_contact.FirstName = value;
          RaisePropertyChanged("FirstName");
        }
      }
    }

    public string LastName
    {
      get
      { 
        return vm_contact.LastName; 
      }
      set
      {
        if (vm_contact.LastName != value)
        {
          vm_contact.LastName = value;
          RaisePropertyChanged("LastName");
        }
      }
    }

    public string Age
    {
      get 
      { 
        return vm_contact.Age; 
      }
      set
      {
        if (vm_contact.Age != value)
        {
          vm_contact.Age = value;
          RaisePropertyChanged("Age");
        }
      }
    }

    public string Email
    {
      get 
      { 
        return vm_contact.Email; 
      }
      set
      {
        if (vm_contact.Email != value)
        {
          vm_contact.Email = value;
          RaisePropertyChanged("Email");
        }
      }
    }

    public string PhoneNumber
    {
      get 
      { 
        return vm_contact.PhoneNumber; 
      }
      set
      {
        if (vm_contact.PhoneNumber != value)
        {
          vm_contact.PhoneNumber = value;
          RaisePropertyChanged("PhoneNumber");
        }
      }
    }
    #endregion


    #region Construction
    /// <summary>
    /// Constructs the default instance of a ContactViewModel
    /// </summary>
    public ContactViewModel()
    {
      vm_contact = new Contact();
    }
    #endregion
  }
}
